from time import sleep
import uiautomation
import pyautogui
class Zhenduanguanli():
        his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
        his.SetFocus()
        zhenduanguanlichuangkou = his.WindowControl(ClassName='Window')
        chuyuanzhenduan_xiyi = his.TabControl(ClassName='TabControl').TabItemControl(ClassName='TabItem',Name='出院诊断(西医)')

        xiyizhenduan = chuyuanzhenduan_xiyi.CustomControl(ClassName='DiagnosisCtrl_CYXYZD').EditControl(AutomationId='PART_TextBox',ClassName='TextBox',foundIndex=1)
        ruyuanbingqing = chuyuanzhenduan_xiyi.CustomControl(ClassName='DiagnosisCtrl_CYXYZD').ComboBoxControl(AutomationId='cb_rybq',ClassName='ComboBox')
        chuyuanqingkuang = chuyuanzhenduan_xiyi.CustomControl(ClassName='DiagnosisCtrl_CYXYZD').ComboBoxControl(AutomationId='cmbCYQK',ClassName='ComboBox')
        baochun = his.WindowControl().ButtonControl(AutomationId='btn_save',ClassName='Button')
        #点击西药诊断
        def click_xyzd(self):
                self.chuyuanzhenduan_xiyi.Click()
        #输入主要诊断
        def input_zyzd(self,zd):
                self.xiyizhenduan.Click()
                self.xiyizhenduan.SendKeys(zd)
                sleep(1)
                pyautogui.press('enter')
        #选择入院病情
        def choose_rybq(self):
                self.ruyuanbingqing.Click()
                self.ruyuanbingqing.GetFirstChildControl().Click()
        #选择chu院病情
        def choose_cybq(self):
                self.chuyuanqingkuang.Click()
                self.chuyuanqingkuang.GetFirstChildControl().Click()

        #点击保存
        def click_bc_btn(self):
                self.baochun.Click()
        #关闭窗口
        def close_window(self):
                self.zhenduanguanlichuangkou.GetWindowPattern().Close()








